package com.itheima.iostream;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileCopyD2C {
    public static void main(String[] args) {
        FileInputStream fin = null;
        FileOutputStream fout =null;
        try{
            fout= new FileOutputStream("C:\\Users\\Administrator\\Saved Games\\D2C.txt");
            fin= new FileInputStream("D:\\Javaproj\\otherfile\\D2C.txt");

            byte[] readBytes = new byte[1024*1024];//1M
            int readCount=0;
            while(readCount!=-1){
                readCount = fin.read(readBytes);
                fout.write(readBytes);
            }



        }catch(FileNotFoundException e){
            e.printStackTrace();
        }catch(IOException e){
            e.printStackTrace();
        }finally{
            if(fin!=null){
                try{
                    fin.close();
                }catch(IOException e){
                    e.printStackTrace();
                }
            }
            if(fout!=null){
                try{
                    fout.close();
                }catch(IOException e){
                    e.printStackTrace();
                }
            }

        }


    }



}
